package fr.upvm.lem3.vm3d.ui.swing.dataload;
/**
 * Base class, which allows inheriting Threads
 * to determine their status
 */
public class StoppableThread extends Thread  {

   private volatile boolean stop = false;

   /**
    * Default constructor
    */
   StoppableThread() {
      super();
   }

   /**
    * Constructor which takes a String as argument
    * @param name Name of the current thread
    */
   StoppableThread(String name) {
      super(name);
   }

   /**
    * Constructor which takes a String and a ThreadGroup-instance as arguments
    * @param g ThreadGroup the thread belongs to
    * @param name Name of the thread
    */
   StoppableThread(ThreadGroup g, String name) {
      super(g, name);
   }

   /**
    * Returns true if the thread needs to stop
    */
   public boolean getStop() {
      return this.stop;
   }

   /**
    * Sets a status-flag indicating that the thread has to stop
    * (true) or not (false)
    * @param value Status as boolean value
    */
   public void setStop(boolean value) {
      this.stop = value;
   }

}
